<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑地址 - 外卖APP</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #f5f5f5;
            font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            color: #333;
        }
        .phone-container {
            width: 390px;
            height: 844px;
            margin: 20px auto;
            background: white;
            position: relative;
            overflow: hidden;
            box-shadow: 0 0 20px rgba(0,0,0,0.1);
            border-radius: 40px;
        }
        .content {
            height: 100%;
            overflow-y: auto;
            background-color: #f8f9fa;
            padding-bottom: 80px; /* 为底部按钮留出空间 */
        }
        .header {
            background: #0095ff;
            color: white;
            padding: 16px;
            position: sticky;
            top: 0;
            z-index: 100;
            display: flex;
            align-items: center;
            gap: 15px;
        }
        .back-btn {
            color: white;
            text-decoration: none;
            font-size: 20px;
            display: flex;
            align-items: center;
        }
        .header-title {
            font-size: 18px;
            font-weight: 600;
            margin: 0;
            flex-grow: 1;
            text-align: center;
            margin-right: 24px;
        }
        .form-container {
            padding: 15px;
        }
        .form-group {
            background: white;
            border-radius: 12px;
            margin-bottom: 15px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.03);
            overflow: hidden;
        }
        .form-item {
            display: flex;
            align-items: center;
            padding: 15px;
            border-bottom: 1px solid #f0f0f0;
        }
        .form-item:last-child {
            border-bottom: none;
        }
        .form-label {
            width: 80px;
            font-size: 15px;
            color: #333;
            flex-shrink: 0;
        }
        .form-input {
            flex: 1;
            border: none;
            outline: none;
            font-size: 15px;
            color: #333;
            padding: 0;
            background: transparent;
        }
        .form-input::placeholder {
            color: #999;
        }
        .form-textarea {
            flex: 1;
            border: none;
            outline: none;
            font-size: 15px;
            color: #333;
            padding: 0;
            background: transparent;
            resize: none;
            height: 60px;
        }
        .form-select {
            flex: 1;
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: #333;
        }
        .form-select-value {
            color: #333;
        }
        .form-select-placeholder {
            color: #999;
        }
        .form-select i {
            color: #ccc;
            font-size: 14px;
        }
        .tag-container {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 10px;
        }
        .tag-item {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .tag-item.active {
            background: rgba(0, 149, 255, 0.08);
            color: #0095ff;
            border: 1px solid #0095ff;
        }
        .tag-item:not(.active) {
            background: #f5f5f5;
            color: #666;
            border: 1px solid transparent;
        }
        .default-switch {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px;
        }
        .default-label {
            font-size: 15px;
            color: #333;
        }
        .switch {
            position: relative;
            display: inline-block;
            width: 40px;
            height: 20px;
        }
        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 20px;
        }
        .slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 2px;
            bottom: 2px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }
        input:checked + .slider {
            background-color: #0095ff;
        }
        input:checked + .slider:before {
            transform: translateX(20px);
        }
        .delete-btn {
            display: block;
            width: 100%;
            padding: 15px;
            text-align: center;
            color: #ff4d4f;
            font-size: 15px;
            background: white;
            border: none;
            border-radius: 12px;
            margin-top: 15px;
            cursor: pointer;
            box-shadow: 0 2px 10px rgba(0,0,0,0.03);
        }
        .bottom-actions {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 15px;
            background: white;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
            z-index: 99;
            width: 100%;
        }
        .save-btn {
            background: #0095ff;
            color: white;
            border: none;
            width: 100%;
            padding: 12px;
            border-radius: 25px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .save-btn:hover {
            background: #0085e5;
        }
    </style>
</head>
<body>
    <div class="phone-container">
        <div class="content">
            <div class="header">
                <a href="address.html" class="back-btn">
                    <i class="bi bi-chevron-left"></i>
                </a>
                <h1 class="header-title">新增收货地址</h1>
            </div>

            <div class="form-container">
                <div class="form-group">
                    <div class="form-item">
                        <div class="form-label">联系人</div>
                        <input type="text" class="form-input" placeholder="请填写收货人姓名">
                    </div>
                    <div class="form-item">
                        <div class="form-label">手机号</div>
                        <input type="tel" class="form-input" placeholder="请填写收货人手机号">
                    </div>
                </div>

                <div class="form-group">
                    <div class="form-item">
                        <div class="form-label">收货地址</div>
                        <div class="form-select">
                            <div class="form-select-placeholder">选择收货地址</div>
                            <i class="bi bi-chevron-right"></i>
                        </div>
                    </div>
                    <div class="form-item">
                        <div class="form-label">详细地址</div>
                        <textarea class="form-textarea" placeholder="请填写详细地址信息，如门牌号、楼层等"></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <div class="form-item">
                        <div class="form-label">标签</div>
                        <div class="tag-container">
                            <div class="tag-item active">家</div>
                            <div class="tag-item">公司</div>
                            <div class="tag-item">学校</div>
                            <div class="tag-item">其他</div>
                        </div>
                    </div>
                    <div class="default-switch">
                        <div class="default-label">设为默认地址</div>
                        <label class="switch">
                            <input type="checkbox">
                            <span class="slider"></span>
                        </label>
                    </div>
                </div>

                <!-- 编辑模式下显示删除按钮 -->
                <button class="delete-btn" style="display: none;">删除收货地址</button>
            </div>

            <!-- 底部保存按钮 -->
            <div class="bottom-actions">
                <button class="save-btn">保存</button>
            </div>
        </div>
    </div>

    <script>
        // 标签切换
        document.querySelectorAll('.tag-item').forEach(tag => {
            tag.addEventListener('click', function() {
                document.querySelectorAll('.tag-item').forEach(t => {
                    t.classList.remove('active');
                });
                this.classList.add('active');
            });
        });

        // 表单验证和提交
        document.querySelector('.save-btn').addEventListener('click', function() {
            // 简单验证
            const name = document.querySelector('.form-item:nth-child(1) .form-input').value;
            const phone = document.querySelector('.form-item:nth-child(2) .form-input').value;
            const address = document.querySelector('.form-textarea').value;
            
            if (!name || !phone || !address) {
                alert('请填写完整信息');
                return;
            }
            
            // 模拟保存成功
            alert('保存成功');
            window.location.href = 'address.html';
        });
    </script>
</body>
</html> 